﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace GUI_QLSV
{
    public partial class frmThemSinhVien : Form
    {
        public frmThemSinhVien()
        {
            InitializeComponent();
        }

        private void bttBrowser_Click(object sender, EventArgs e)
        {
            Stream myStream = null;
            OpenFileDialog openFileDialog1 = new OpenFileDialog ();
            openFileDialog1.InitialDirectory = "D:\\";
            openFileDialog1.Filter = "txt files (*.txt) |*.txt |All files (*.*)|*.*";
            openFileDialog1.FilterIndex = 2;
            openFileDialog1.RestoreDirectory = true;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    //string a = openFileDialog1.FileName;
                    txtPath.Text = openFileDialog1.FileName;
                    if ((myStream == openFileDialog1.OpenFile()) != null)
                    {
                        using (myStream)
                        {
                            //
                        }
                    }
                    MessageBox.Show("Thêm sinh viên thành công","Thông báo",MessageBoxButtons.OK,MessageBoxIcon.Information);
                }
                catch(Exception ex)
                {
                    MessageBox.Show("Lỗi: Không thể đọc được file từ Ổ Đĩa: " + ex.Message);
                }
            }
        }
    }
}
